package jgl.vajra.kingkong.bean;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.List;

/**
 * 下单需要上传的参数
 */
public class OrderParametersBean implements Parcelable {

    public OrderParametersBean() {

    }

    public String hour;
    public String minute;
    public String area;
    public String model;
    public int workTime;
    public String workContent;
    public String amount;
    public String favorablePrice;
    public int priceType;
    public List<AddressData> addressData;

    public static class AddressData implements Parcelable {

        public AddressData() {

        }

        public int addressType;
        public String address;
        public String longitude;
        public String latitude;
        public String contactPerson;
        public String contactPhone;
        public String city;

        protected AddressData(Parcel in) {
            addressType = in.readInt();
            address = in.readString();
            longitude = in.readString();
            latitude = in.readString();
            contactPerson = in.readString();
            contactPhone = in.readString();
            city = in.readString();
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeInt(addressType);
            dest.writeString(address);
            dest.writeString(longitude);
            dest.writeString(latitude);
            dest.writeString(contactPerson);
            dest.writeString(contactPhone);
            dest.writeString(city);
        }

        @Override
        public int describeContents() {
            return 0;
        }

        public static final Creator<AddressData> CREATOR = new Creator<AddressData>() {
            @Override
            public AddressData createFromParcel(Parcel in) {
                return new AddressData(in);
            }

            @Override
            public AddressData[] newArray(int size) {
                return new AddressData[size];
            }
        };
    }

    protected OrderParametersBean(Parcel in) {
        model = in.readString();
        hour = in.readString();
        minute = in.readString();
        area = in.readString();
        workTime = in.readInt();
        workContent = in.readString();
        amount = in.readString();
        favorablePrice = in.readString();
        priceType = in.readInt();
        addressData = in.createTypedArrayList(AddressData.CREATOR);
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(model);
        dest.writeString(hour);
        dest.writeString(minute);
        dest.writeString(area);
        dest.writeInt(workTime);
        dest.writeString(workContent);
        dest.writeString(amount);
        dest.writeString(favorablePrice);
        dest.writeInt(priceType);
        dest.writeTypedList(addressData);
    }

    @Override
    public int describeContents() {
        return 0;
    }

    public static final Creator<OrderParametersBean> CREATOR = new Creator<OrderParametersBean>() {
        @Override
        public OrderParametersBean createFromParcel(Parcel in) {
            return new OrderParametersBean(in);
        }

        @Override
        public OrderParametersBean[] newArray(int size) {
            return new OrderParametersBean[size];
        }
    };
}
